﻿@model Wicresoft.UnifyShow.Business.SelfBreakDwonModel
@{
    ViewBag.Title = "添加故障";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
    string error = (string)ViewBag.error;
    bool post = ViewBag.Post ?? false;
}
<div class="index_lr">
    @if (post && string.IsNullOrWhiteSpace(error))
    {
        <script type="text/javascript">

            $(document).ready(function () {
                alert("添加成功。")
            });
        </script> 
    }
    @if (post && !string.IsNullOrWhiteSpace(error))
    { 
        <span style="color: Red" id="errorInfo1">@error 已经存在服务故障。</span>
    }
    <span style="color: Red" id="errorInfo"></span>
    <ul>
        <li class="index_lr2_M">
            <div class="index_lrA_title ui-icons">
                <h3>
                    添加业务系统</h3>
            </div>
            @using (Html.BeginForm())
            {
                <div class="index_pt_bg">
                    <table>
                        <tbody>
                            <tr>
                                <td width="8%">
                                    <label> 故障名称：</label>
                                </td>
                                <td width="22%">
                                    @Html.EditorFor(model => model.LvlName)
                                </td>
                                <td width="8%">
                                    <label>
                                        系统分类：</label>
                                </td>
                                <td width="22%">
                                    @Html.DropDownList("Categroy", (IEnumerable<SelectListItem>)ViewData["Categories"])
                                </td>
                            </tr>
                            
                           
                        </tbody>
                    </table>
                    <p>
                        <input type="submit" value="添加" id="addSubmit" />
                    </p>
                </div>
            }
        </li>
    </ul>
</div>
@section ScriptAndCss{
    @*    <script src="../../Scripts/jquery-1.4.4-vsdoc.js" type="text/javascript"></script>*@
    <script type="text/javascript">
        $(function () {
            $("form").submit(function () {
                var error = ""
                if ($("#LvlName").val() == "") error += "系统名称不能为空。";
                if (error != "") {
                    $("#errorInfo").html(error);
                    return false;
                }
                return true;
            });
        });
    </script>
}
